package demo2;

import java.util.ArrayList;
import java.util.List;

public class test1 {
    public static void main(String[] args) {
        //把员工添加到集合中，然后对员工信息进行操作
        //1.三个员工

        Emp emp1 = new Emp();
        emp1.setNumber("1001");
        emp1.setName("小明");
        emp1.setAge(18);
        Emp emp2 = new Emp();
        emp2.setNumber("1001");
        emp2.setName("小红");
        emp2.setAge(19);

        Emp emp3 = new Emp();
        System.out.println(emp3.getNumber());
        System.out.println(emp3.getName());
        System.out.println(emp3.getAge());
        System.out.println(emp3);
        List<Emp> list = new ArrayList();
        list.add(emp1);
        list.add(emp2);
        list.add(emp3);
        System.out.println("集合的元素");
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));


        }
    }
}
